define(function () {
    'use strict';

    function ctrl($scope,WebService) {

        $scope.subjectData = new Array();

        $scope.$on('$ionicView.loaded', function() {
            init();
        });

        $scope.doRefresh = function() {
            init();
            $scope.$broadcast("scroll.refreshComplete");
        };

        $scope.accessRecord = function(index){
            if(typeof Messenger != 'undefined') {
                Messenger.sendMsg("ym_event",{eventID:"ls"+(1+index)},null,null);
            }
        }

        function init(){
            WebService.wtAd("xcm_history").then(function(data){
                $scope.subjectData = data;
            });
        }
    }

    ctrl.$inject = ['$scope','WebService'];
    return ctrl;
});